﻿

using System;
using System.Web;
using System.Web.SessionState;

public static class SessionStateBaseExtensions
{
	public static StronglyTypedSessionState Typed(this HttpSessionStateBase sessionState)
	{
		return new StronglyTypedSessionState(sessionState);
	}
	
	public static StronglyTypedSessionState Typed(this HttpSessionState sessionState)
	{
		var wrapper = new HttpSessionStateWrapper(HttpContext.Current.Session);
		return new StronglyTypedSessionState(wrapper);
	}
}

public class StronglyTypedSessionState
{
	private HttpSessionStateBase sessionState;

	internal StronglyTypedSessionState(HttpSessionStateBase sessionState)
	{
		this.sessionState = sessionState;
	}
	
	
	///<summary>Credentials used to connect to WSUS server</summary>
	public System.Net.NetworkCredential Credentials
	{
		get { return (System.Net.NetworkCredential)sessionState["Credentials"]; }
		set { sessionState["Credentials"] = value; }
	}
	
	///<summary>Host data of WSUS server</summary>
	public WsusWebAdmin.Web.Wsus.WsusHostData WsusHost
	{
		get { return (WsusWebAdmin.Web.Wsus.WsusHostData)sessionState["WsusHost"]; }
		set { sessionState["WsusHost"] = value; }
	}
	
}